package com.liqi.frame.comm.exception;

import com.liqi.frame.comm.dto.HttpResult;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * 全局处理过滤器中的异常
 *
 * @description:
 * @author: liqi
 * @time: 2022/3/30
 */
@RestController
@RequestMapping("filterExceptionController")
public class FilterExceptionHandlerController {
    @RequestMapping("/{code}/{message}")
    @ResponseBody
    public HttpResult shiroException(HttpServletRequest request,
                            @PathVariable("code") Integer code,
                            @PathVariable("message") String message) throws Exception {
        return HttpResult.result(code, message, null);
    }
}
